<template>
	<view class="wrap">
		<view class="wrap-list">
			<block v-for="(item, index) in list" :key="index">
				<view class="item flex align-center just-between" @click="onItem(item)" v-if="item.isShow">
					<image class="icon" :src="$staticImagePath(item.icon)" />

					<view class="name f-26">{{ item.title }}</view>

					<image class="arrow" :src="$staticImagePath('publish/arrow_right.png')" />
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [
					{
						title: "支付密码",
						icon: "setting/pay_password.png",
						handler: () => {
							this.$jump.to(`/pages/mine/setting/payPassword`);
						},
						isShow: true
					},
					{
						title: "发票管理",
						icon: "setting/invoice.png",
						handler: () => {
							this.$jump.to(`/pages/mine/invoice/invoiceManager`);
						},
						isShow: true
					},
					{
						title: "银行卡管理",
						icon: "setting/bank.png",
						handler: () => {
							this.$jump.to(`/pages/user/bank/bank`)
						},
						isShow: true
					},
					{
						title: "隐私协议",
						icon: "setting/privacy.png",
						handler: () => {
							this.$jump.goHTMLWeb("隐私协议", "privacy_protection");
						},
						isShow: true
					},
					{
						title: "注销协议",
						icon: "setting/cancellation.png",
						handler: () => {
							this.$jump.goHTMLWeb("注销协议", "cancel_agreement");
						},
						isShow: true
					},
					{
						title: "关于平台",
						icon: "setting/platform.png",
						handler: () => {
							this.$jump.to(`/pages/mine/setting/about`);
						},
						isShow: true
					},
					{
						title: "注销合伙人",
						icon: "setting/cancel_partner.png",
						handler: () => {
							this.$jump.to(`/pages/mine/setting/cancelPartner`);
						},
						isShow: false
					},
					{
						title: "退出登录",
						icon: "setting/logout.png",
						handler: () => {
							this.$filters.onLogout();
						},
						isShow: true
					},
				],
			};
		},
		onShow() {
			this.$commonNetwork.getUserIdenInfoData(res => {
				this.list.forEach((item) => {
					if (item.title === "注销合伙人") {
						item.isShow = res.partner_type > 0
					}
				})
			})
		},
		methods: {
			/**
			 * 点击
			 */
			onItem(item) {
				item.handler();
			},
		}
	};
</script>

<style lang="scss" scoped>
	.wrap {
		padding: 25rpx;
		box-sizing: border-box;

		.wrap-list {
			width: 100%;
			overflow: hidden;
			background-color: white;
			border-radius: 10rpx;
			box-shadow: 0px 6upx 12upx rgba(0, 0, 0, 0.05);

			.item {
				width: 100%;
				height: 100rpx;
				border-bottom: 2rpx solid #eeeeee;
				overflow: hidden;
				padding: 0 20rpx;
				box-sizing: border-box;
				gap: 20rpx;

				&:last-child {
					border-bottom: none;
				}

				.icon {
					width: 40rpx;
					height: 40rpx;
				}

				.name {
					flex: 1;
					overflow: hidden;
					color: #333333;
				}

				.arrow {
					width: 14rpx;
					height: 24rpx;
				}
			}
		}
	}
</style>
